package com.bitoon.basketdudes.web.jpa;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "parcial", schema = "basket")
@NamedQueries({
    //@NamedQuery(name = "Parcial.findAll", query = "SELECT p FROM Parcial p")
    @NamedQuery(name = "Parcial.findById", query = "SELECT p FROM Parcial p WHERE p.parcialPK.equipo1 = :idEquipo1 AND p.parcialPK.equipo2 = :idEquipo2")
})
public class Parcial implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ParcialPK parcialPK;
    @Basic(optional = false)
    @Column(name = "victorias1")
    private short victorias1;
    @Basic(optional = false)
    @Column(name = "victorias2")
    private short victorias2;

    public Parcial() {
    }

    public Parcial(ParcialPK parcialPK) {
        this.parcialPK = parcialPK;
    }

    public Parcial(ParcialPK parcialPK, short victorias1, short victorias2) {
        this.parcialPK = parcialPK;
        this.victorias1 = victorias1;
        this.victorias2 = victorias2;
    }

    public Parcial(int equipo1, int equipo2) {
        this.parcialPK = new ParcialPK(equipo1, equipo2);
    }

    public ParcialPK getParcialPK() {
        return parcialPK;
    }

    public void setParcialPK(ParcialPK parcialPK) {
        this.parcialPK = parcialPK;
    }

    public short getVictorias1() {
        return victorias1;
    }

    public void setVictorias1(short victorias1) {
        this.victorias1 = victorias1;
    }

    public short getVictorias2() {
        return victorias2;
    }

    public void setVictorias2(short victorias2) {
        this.victorias2 = victorias2;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (parcialPK != null ? parcialPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Parcial)) {
            return false;
        }
        Parcial other = (Parcial) object;
        if ((this.parcialPK == null && other.parcialPK != null) || (this.parcialPK != null && !this.parcialPK.equals(other.parcialPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.web.jpa.Parcial[parcialPK=" + parcialPK + "]";
    }

}
